package cn.edu.pku.action;

import java.util.List;
import java.util.ArrayList;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.edu.pku.model.Human;
import cn.edu.pku.dao.HumanDao;
import cn.edu.pku.dao.HumanmgtDao;

import com.opensymphony.xwork2.ActionSupport;

public class ViewAllHRRecordsAction extends ActionSupport implements BaseAction {
	private HttpServletRequest request;
	private HttpServletResponse response;
	private Map att;

	private HumanDao humanDao;
	private HumanmgtDao humanmgtDao;
	private List<Human> humans;

	public String execute() throws Exception {

		humans = new ArrayList<Human>();
		humans = humanDao.findAll();
		request.setAttribute("total", humans.size());

		return SUCCESS;
	}

	public List<Human> getHumans() {
		return humans;
	}

	public void setHumans(List<Human> humans) {
		this.humans = humans;
	}

	public HumanDao getHumanDao() {
		return humanDao;
	}

	public void setHumanDao(HumanDao humanDao) {
		this.humanDao = humanDao;
	}

	public HumanmgtDao getHumanmgtDao() {
		return humanmgtDao;
	}

	public void setHumanmgtDao(HumanmgtDao humanmgtDao) {
		this.humanmgtDao = humanmgtDao;
	}

	@Override
	public void setServletRequest(HttpServletRequest request) {
		// TODO Auto-generated method stub
		this.request = request;
	}

	@Override
	public void setServletResponse(HttpServletResponse response) {
		// TODO Auto-generated method stub
		this.response = response;
	}

	@Override
	public void setSession(Map att) {
		// TODO Auto-generated method stub
		this.att = att;
	}

}
